# = Abstract Class AST
# Implementation of the abstract class AST, which represents an Abstract Symbol Tree
# for the programming language Vectorinox

class AST
  # Represents de main symbol of the operation represented by the AST
  attr_reader :node
  # Represents all te operands of the operation
  attr_reader :children
  @@c = '  '

  # Constructor for the class. It has no parameters, for the values necesary to create the AST
  # are associated with each particular implementation
  def initialize
  end
  
  # Method used to check the static correctitude of the programm
  def check parent_sym_table, func_table, func_type
    
  end
  
  # Method used to execute the program
  def run
    
  end
  
  # Method used to create a 'String' repepresentation of the AST
  def to_s i
    
  end

  # Method which finds the first token responsible of the error
  def error_location
    @error = error_tk
    if nil == @error
      'Ubicación desconocida'
    end
    if error_tk.kind_of?AST
      return @error.to_s("    ")
    end
    @error.to_s
  end

  def error_tk
    nil
  end
  
  # Creates a 'String' representation of all the children of the AST
  # === Parameters
  # * im: Identation with which the AST should be printed with
  def to_s_children im
    output = ''
    i = 0
    for c in @children
      output += "\n#{im}" + c.to_s(im)
      i += 1
    end
    output
  end
end